package cate.game.res.spicecall;

import cate.game.db.facade.KvLoader;
import cate.game.db.mongo.kv.KvMongo;
import cate.game.framework.ModuleMan;
import cate.game.role.Role;
import cate.game.role.res.spicecall.msg.SpiceCallLogResp;
import cate.game.videohall.po.VideoHallSPO;

public class SpiceCallManager extends ModuleMan {
    private SpiceCallSPO status;
    @Override
    public void initDependent() throws Exception {
        status = new KvLoader<>(game, SpiceCallSPO.class, KvMongo.KEY_SPICE_CALL_DATA).getBySrvId();
    }

    public void addLog(int pos, String name, int rewardId){
        status.addLog(pos, name, rewardId);
    }

    @Override
    public void shutdown(){
        game.db.kv.save(status);
    }

    public void noticeUpdate(Role role) {
        role.sendNow(new SpiceCallLogResp(status.logs));
    }
}
